// Author: lyc
// Deprecated!
// A simple hash set used for memory reserving "vis".

#include "stdlib.h"
#include "hash_set.h"




void hash_set_init(HashSet* s, int n) {
    //s->next = (uint16_t*)malloc((sizeof(uint16_t)) * n);
    //s->data = (hash_set_int*)malloc((sizeof(hash_set_int)) * n);
    for (register int i = 0; i < n; i++) {
        s->next[i] = (uint16_t)0;
        s->data[i] = (hash_set_int)0;
    }

    for (register int i = 0; i < HASH_SET_MAXW; i++) {
        s->head[i] = 0;
    }
    s->n_cnt = 1;
}

void hash_set_insert(HashSet* s, hash_set_int x, hash_set_int y) {
    //s->test[x][y] = 1;
    return;
    if (hash_set_query(s, x, y)) {
        return;
    }
    s->data[s->n_cnt] = y;
    s->next[s->n_cnt] = s->head[x];
    s->head[x] = s->n_cnt++;
}


hash_set_bool hash_set_query(HashSet* s, hash_set_int x, hash_set_int y) {
    //return s->test[x][y];
    for (int u = s->head[x]; u; u = s->next[u]) {
        if (s->data[u] == y) {
            return (hash_set_bool)1;
        }
    }
    return (hash_set_bool)0;
}
